/**
 * 
 */
package org.tiger.common.domain;

/**
 * @author liuwenlai
 *
 */
public class ResponseBean<T> {

	private String messages;

	private T result;

	/**
	 * 初始化
	 */
	private boolean success = true;

	public ResponseBean() {
	}

	public ResponseBean(T result) {
		this.result = result;
	}

	public ResponseBean(T result, boolean success) {
		this.result = result;
		this.success = success;
	}

	public ResponseBean(T result, boolean success, String messages) {
		this.result = result;
		this.success = success;
		this.messages = messages;
	}

	public static <T> ResponseBean success(T result){
		return new ResponseBean(result,true);
	}

	public static <T> ResponseBean success(T result, String messages){
		return new ResponseBean(result,true,messages);
	}

	public static <T> ResponseBean fail(T result){
		return new ResponseBean(result,false);
	}

	public static <T> ResponseBean fail(T result, String messages){
		return new ResponseBean(result,false,messages);
	}

	/**
	 * @return the messages
	 */
	public String getMessages() {
		return messages;
	}

	/**
	 * @param messages
	 *            the messages to set
	 */
	public void setMessages(String messages) {
		this.messages = messages;
	}

	/**
	 * @return the result
	 */
	public T getResult() {
		return result;
	}

	/**
	 * @param result
	 *            the result to set
	 */
	public void setResult(T result) {
		this.result = result;
	}

	/**
	 * @return the success
	 */
	public boolean isSuccess() {
		return success;
	}

	/**
	 * @param success
	 *            the success to set
	 */
	public void setSuccess(boolean success) {
		this.success = success;
	}

}
